package org.third.security.jaas;

import java.security.Principal;

public final class UniqueNamePrincipal implements Principal {

    private String name;

    public UniqueNamePrincipal(String name) {
        this.name = "Unique-" + name;
    }

    public String getName() {
        return name;
    }

    public boolean equals(Object o) {
        return (o instanceof UniqueNamePrincipal) && this.name.equalsIgnoreCase(((UniqueNamePrincipal) o).name);
    }

    public int hashCode() {
        return name.toUpperCase().hashCode();
    }

}